<%@page import="java.util.*"%>
<%@page import="paquetes.negocioVO.ClienteVO"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"    pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Editar Cliente</title>
<script type="text/javascript">
function validar(){
	if(document.form.nombre.value==''){
		alert('El campo nombre esta vacio');
		document.form.nombre.focus();
		return false;
	}
	if(document.form.documento.value==''){
		alert('El campo documento esta vacio');
		document.form.documento.focus();
		return false;
	}
	if(document.form.telefonocontacto.value==''){
		alert('El campo telefono esta vacio');
		document.form.telefonocontacto.focus();
		return false;
	}
}

function soloNumeros(evt){
	if(window.event){
		keynum = evt.keyCode;
	}else{
		keynum = evt.which;
	}
	if(keynum>47 && keynum<58){
		return true;
	}else{
		return false;
	}
}
</script>
</head>
<body>
	<%
	ClienteVO c = (ClienteVO)request.getAttribute("cliente");
	String successMsg = "";
	if(!String.valueOf(request.getAttribute("successMsg")).equals("") && request.getAttribute("successMsg")!=null){
		successMsg=String.valueOf(request.getAttribute("successMsg"));
	}
	
	%>
	<form name="form" action="ControladorCliente?action=save&id=<%=c.getId()%>" method="post" onsubmit="return validar();">
	<table>
	<tr>
		<td><b>Nombre:</b></td>
	  <td><input type="text" name="nombre" value="<%=c.getNombre()%>" size=20></td>
	</tr>
	<tr>
		<td><b>Documento:</b> </td>
	  <td><input type="text" name="" value="<%=c.getDocumento()%>" size=25 ></td>
	</tr>
	<tr>
		<td><b>TelefonoContacto:</b> </td>
	  <td><input type="text" name="telefonocontacto" value="<%=c.getTelefonoContacto()%>" size=10 onkeypress="return soloNumeros(event)"></td>
	</tr>
	<tr>
		<td><input type="submit" value="editar cliente"></td>
		<td>
		<strong style="color: green;">
		
		<%=successMsg%>
		
		</strong>
		</td>
	</tr>
	</table>
	</form>
</body>
</html>